package javaDemo06;

public class SuShu {
    public static void main(String[] args) {
        sushu(10);
    }
    public static void sushu(int jiange){
        int count = 1;
        for(int i = 2;i <= 1000;i++){
            boolean a = true;
            for(int j = 2;j <= i/2;j++){
                if(i % j == 0){
                    a = false;
                }
            }
            for(int j = 2;j <= (i + 2)/2;j++){
                if((i + 2) % j == 0){
                    a = false;
                }
            }
            if(a){
                if(count < jiange) {
                    count++;
                    System.out.print(i + "和" + (i + 2) + "\t\t");
                }else if (count == jiange){
                    System.out.println(i + "和" + (i + 2) + "\t\t");
                    count = 1;
                }
            }
        }
    }
}
